/*
 * Project Name: tennis
 * $Id:  UserPlayRelService.java 2016-05-13 15:26:42 $
 */

package org.aceor.tennis.service;

import com.google.common.base.Optional;
import org.aceor.tennis.common.domain.BaseDomain;
import org.aceor.tennis.common.domain.UserPlayRel;
import org.aceor.tennis.common.exception.BusinessRuntimeException;

import java.util.List;

public interface IUserPlayRelService<T extends BaseDomain> extends IBaseService<T>{

    List<UserPlayRel> queryHasSignUpUsers(Long playId) throws BusinessRuntimeException;

    Optional<UserPlayRel> queryOneUserPlayRel(Long userId, Long playId) throws BusinessRuntimeException;

    /**
     * 报名
     * @param userId
     * @param playId
     * @return
     * @throws BusinessRuntimeException
     */
    Optional<UserPlayRel> signUpOnePlay(Long userId, Long playId) throws BusinessRuntimeException;

    /**
     * 同意报名
     * @param userId
     * @param playId
     * @return
     * @throws BusinessRuntimeException
     */
    void agreeSignUpOnePlay(Long userId, Long playId) throws BusinessRuntimeException;

    /**
     * 不同意报名
     * @param userId
     * @param playId
     * @return
     * @throws BusinessRuntimeException
     */
    void disAgreeSignUpOnPlay(Long userId, Long playId) throws BusinessRuntimeException;

    /**
     *
     * @param userId
     * @return
     * @throws BusinessRuntimeException
     */
    List<UserPlayRel> queryHasJoinPlays(Long userId) throws BusinessRuntimeException;
}
